package models;

import play.modules.m4fcity.M4FCityProfile;
import play.modules.market.MarketProfile;
import siena.embed.EmbeddedMap;

@EmbeddedMap
public class Profile {
	public static String MARKET_PREFIX = "market";
	public static String M4FCITY_PREFIX = "m4fcity";
	
	/** The id. */
	private String id;
	
	/** The type of the profile. */
	private String type;
	
	/** The email. */
	private String email;
	
	/** The first name. */
	private String firstName;
	
	/** The last name. */
	private String lastName;
	
	/** The domain of the user. */
	private String domain;
	
	/** The organization id. */
	private Long organization;
	
	/** The manager flag. */
	private boolean manager;
	
	/** The access token. */
	private String accessToken;
	
	public Profile() {}

	public Profile(M4FCityProfile profile) {
		this.id = profile.getId();
		this.type = M4FCITY_PREFIX;
		this.email = profile.getEmail();
		this.firstName = profile.getFirstName();
		this.lastName = profile.getLastName();
		this.organization = profile.getOrganization();
		this.manager = profile.isManager();
		this.accessToken = profile.getAccessToken();
	}
	
	public Profile(MarketProfile profile) {
		this.id = profile.getId();
		this.type = MARKET_PREFIX;
		this.email = profile.getEmail();
		this.firstName = profile.getFirstName();
		this.lastName = profile.getLastName();
		this.domain = profile.getDomain();
		this.organization = new Long(0); // TODO Get organization or data from google
		this.manager = profile.isAdmin() != null ? profile.isAdmin() : false;
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public Long getOrganization() {
		return organization;
	}

	public void setOrganization(Long organization) {
		this.organization = organization;
	}

	public boolean isManager() {
		return manager;
	}

	public void setManager(boolean manager) {
		this.manager = manager;
	}

	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}
}
